package com.voxel.sense.infomsg.utils.cover;

import com.voxel.sense.infomsg.data.bean.ConditionBean;

import java.util.ArrayList;
import java.util.List;

import cyy.example.com.facotry.model.api.response.SearchMenuEntity;

/**
 * @author ChenYiYao
 * @date 2018/5/14
 * des :
 */
public class ConfigData2ConditionBeanCoverUtile implements BaseCoverStrategy<ConditionBean, SearchMenuEntity> {
    @Override
    public List<ConditionBean> convertEntity(SearchMenuEntity data, String type) {
        List<ConditionBean> datas = new ArrayList<>();
        if (data == null || data.getStaticSystemConstantDetails() == null ||
                data.getStaticSystemConstantDetails().size() <= 0) {
            return datas;
        }
        List<SearchMenuEntity.StaticSystemConstantDetailsBean> conditions = data.getStaticSystemConstantDetails();
        for (SearchMenuEntity.StaticSystemConstantDetailsBean bean : conditions) {
            String icon = "";
            ConditionBean conditionBean = new ConditionBean(type, bean.getConstantCode(),
                    bean.getConstantName(), icon, false);
            datas.add(conditionBean);
        }
        return datas;
    }
}
